#include <stdio.h>

void quickSort(int *realNumbers,int left, int right){
	if(left>=right)
		return;

	int pivot = left, tempLeft= left, tempRight= right;
	int pivotNum = realNumbers[pivot];
	while(tempLeft<tempRight){

		while (tempLeft<tempRight&&pivotNum<=realNumbers[tempRight])
			tempRight--;

		realNumbers[pivot]=realNumbers[tempRight];
		realNumbers[tempRight]=pivotNum;
		pivot = tempRight;

		while (tempLeft<tempRight&&pivotNum>=realNumbers[tempLeft])
			tempLeft++;

		realNumbers[pivot]=realNumbers[tempLeft];
		realNumbers[tempLeft]=pivotNum;
		pivot = tempLeft;
	}
	quickSort(realNumbers,left,pivot-1);
	quickSort(realNumbers,pivot+1,right);
}
int main(){
	int size=6;
	int realNumbers[6]={12,15,32,4,21,5};
	quickSort(realNumbers,0,size-1);
	for (int i=0;i<size;i++)
	{
		printf("%d ",realNumbers[i]);
	}
	printf("\n");
	return 0;
}